<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>哈哈马帐号注册</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">
    <meta name="_token" content="{{ csrf_token() }}"/>

    <link id="callCss" rel="stylesheet" href="/adminHTML/web/themes/bootshop/bootstrap.min.css" media="screen"/>
    <link href="/adminHTML/web/themes/css/base.css" rel="stylesheet" media="screen"/>
<!-- Bootstrap style responsive -->	
	<link href="/adminHTML/web/themes/css/bootstrap-responsive.min.css" rel="stylesheet"/>
	<link href="/adminHTML/web/themes/css/font-awesome.css" rel="stylesheet" type="text/css">
<!-- Google-code-prettify -->	
	<link href="/adminHTML/web/themes/js/google-code-prettify/prettify.css" rel="stylesheet"/>
<!-- fav and touch icons -->
    <link rel="shortcut icon" href="/adminHTML/web/themes/images/ico/favicon.ico">
    <link rel="apple-touch-icon-precomposed" sizes="144x144" href="/adminHTML/web/themes/images/ico/apple-touch-icon-144-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="/adminHTML/web/themes/images/ico/apple-touch-icon-114-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="72x72" href="/adminHTML/web/themes/images/ico/apple-touch-icon-72-precomposed.png">
    <link rel="apple-touch-icon-precomposed" href="/adminHTML/web/themes/images/ico/apple-touch-icon-57-precomposed.png">
	<style type="text/css" id="enject"></style>
  </head>
<body style='background: #f5f5f5;color: #757575;'>
	<script src="/adminHTML/web/themes/js/jquery.js" type="text/javascript"></script>
	<script src="/adminHTML/web/themes/js/bootstrap.min.js" type="text/javascript"></script>
	<script src="/adminHTML/web/themes/js/google-code-prettify/prettify.js"></script>
	
	<script src="/adminHTML/web/themes/js/bootshop.js"></script>
    <script src="/adminHTML/web/themes/js/jquery.lightbox-0.5.js"></script>

<!-- Header End====================================================================== -->
<div id="mainBody">
	<div class="container">
	<div class="row">
<!-- Sidebar ================================================== -->
 	
<!-- Sidebar end=============================================== -->
	<div class="span9" style='margin-top:78px;'>
	<div class="row">
		<div class="span4">
			
		</div>
		<!-- <div class="span1"> &nbsp;</div> -->
		<div class="span4">
			<div class="well">
			<h3 style='text-align: center'>哈哈马帐号注册</h3>
			<form action="/email/zhuce" method="post">
			  <div class="control-group">
				
				<div class="controls">
				  <label class="control-label" for="inputEmail1">用户名</label><input class="span3"  type="text" id="username" name="username" placeholder="请输入6-18位用户名">
				</div>
				<i id="yzm" style="display:none">请输入6-18位用户名</i>
				<i id="yhycz" style="display:none">用户已存在</i>
			  </div>
			  <div class="control-group">
				<label class="control-label" for="inputPassword1">密码</label>
				<div class="controls">
				  <input type="password" class="span3" name="password" id="Password" placeholder="Password">
				<i id="mima" style="display:none">密码太短建议6-18位字符</i>
				</div>
			  </div>
			  <div class="control-group">
				<label class="control-label" for="inputPassword1">确认密码</label>
				<div class="controls">
				  <input type="password" class="span3" name="repassword" id="Repassword" placeholder="Repassword">
				  <i id="nomima" style="display:none">请先输入确认密码</i>
				  <i id="remima" style="display:none">两次密码不一样</i>
				</div>
			  </div>
			  <div class="control-group">
				<label class="control-label" for="inputPassword1">邮箱</label>
				<div class="controls">
				 <input type="text" class="span3"  id="email" name="email" placeholder="Email">
					<i id="errmail" style="display:none">邮箱出问题啦!</i>
				 <div class="btn btn-default" id="emailyzm">获取验证码</div>
				 <p style='display:none' id='emailnull'>请先输入邮箱</p>
				 <p style='display:none' id='yzmyfs'>验证码已发送</p>
				 
				</div>
			  </div>
			  <div class="control-group">
				<label class="control-label" for="inputPassword1">验证码</label>
				<div class="controls">
				 <input type="text" class="span2" class="code" id="code" name="num" placeholder="code">
				 <p style='display:none' id='yzmcw'>验证码错误</p>
				</div>
			  </div>
			  {{csrf_field()}}
			  <div class="control-group">
				<div class="controls">
				  <button type="submit" class="btn">提交</button> <button type="reset" class="btn">重置</button>
				</div>
			  </div>
			</form>
		</div>
		</div>
	</div>
</div>
</div></div>
</div>
<script type="text/javascript">
$('input[name=username]').focus(function(){
	var yhycz = document.getElementById('yhycz');
	yhycz.style.display = 'none';
	var yzm = document.getElementById('yzm');
	yzm.style.display = 'none';
	})
$('input[name=repassword]').focus(function(){
	var nomima = document.getElementById('nomima');
	nomima.style.display = 'none';
	var remima = document.getElementById('remima');
	remima.style.display = 'none';
	})
$('input[name=email]').focus(function(){
	var errmail = document.getElementById('errmail');
	errmail.style.display = 'none';
	})
$('input[name=username]').blur(function(){
		//检测用户名是否正确
		var reg = /^\w{6,18}$/;
		//获取用户名
		var username = $(this).val();
		//检测
		var res = reg.test(username);
		if(!res){
			var yzm = document.getElementById('yzm');
			yzm.style.display = 'block';
			//阻止发送ajax
			return false;
		}
		$.ajax({
			url:'/home/yhm',
			data:{username:username},
			type:'get',
			headers: {'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content')},
			//同步
			async:false,
			success:function(data){
				//判断用户名是否可用
				if(data == 1){
					//用户不可用
					var yhycz = document.getElementById('yhycz');
					yhycz.style.display = 'block';
				}else{
					//用户不可用
					var yhycz = document.getElementById('yhycz');
					yhycz.style.display = 'none';
				}
			},
			error:function(){
				alert('ajax错误');
			}
		})
	})
// 密码
	$('input[name=password]').blur(function(){
		//获取密码的值
		var pass = $(this).val();
		//正则
		var reg = /^\w{6,18}$/;
		if(!reg.test(pass)){
			//不正确
			var mima = document.getElementById('mima');
			mima.style.display = 'block';
		}else{
			var mima = document.getElementById('mima');
			mima.style.display = 'none';
		}
	})

	//确认密码
	$('input[name=repassword]').blur(function(){
		//获取确认密码的值
		var repass = $(this).val();
		//获取密码的值
		var pass = $('input[name=password]').val();
		if(repass == ''){
			var nomima = document.getElementById('nomima');
			nomima.style.display = 'block';
		}else{
			var nomima = document.getElementById('nomima');
			nomima.style.display = 'none';
		}
		// 判断
		if(repass == pass){
			//正确
			var remima = document.getElementById('remima');
			remima.style.display = 'none';
		}else{
			//错误
			var remima = document.getElementById('remima');
			remima.style.display = 'block';
		}
	})
	//检测邮箱
	$('input[name=email]').blur(function(){
		//获取邮箱的值
		var email = $(this).val();
		//正则
		var reg = /^\w+@\w+\.(com|cn|com.cn|net|org)$/;
		//检测
		if(reg.test(email)){
			//正确
			var errmail = document.getElementById('errmail');
			errmail.style.display = 'none';
			EMAIL = true;
		}else{
			//错误
			var errmail = document.getElementById('errmail');
			errmail.style.display = 'block';
		}
	})

	$('#emailyzm').click(function(){
		document.getElementById('yzmyfs').style.display = 'block';
		var email11 = $('#email').val();
		$.ajax({
			url:'/email/sendmail',
			data:{email:email11},
			type:'get',
			headers: {'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content')},
			//同步
			async:false,
			success:function(data){
				var str = data;
				$('input[name=num]').focus(function(){
				if($(this).val() != str ){
						document.getElementById('yzmcw').style.display = 'block';
					}else{
						document.getElementById('yzmcw').style.display = 'none';
					}
				})
			},
		})
		
	})
$('input[name=num]').focus(function(){
	document.getElementById('yzmcw').style.display = 'block';
})

	

</script>
<!-- Footer ================================================================== -->
	<div  id="footerSection">
	<div class="container">
		<div class="row">
			<div class="span2">
				<h5>帮助中心</h5>
				<a href="#">账户管理</a>
				<a href="#">购物指南</a> 
				<a href="#">ADDRESSES</a> 
				<a href="#">订单操作</a>  
				<a href="#">ORDER HISTORY</a>
			 </div>
			<div class="span2">
				<h5>服务与支持</h5>
				<a href="#">售后政策</a>  
				<a href="#">自助服务</a>  
				<a href="#">相关下载</a>  
				
			 </div>
			<div class="span2">
				<h5>下线门店</h5>
				<a href="#">小米之家</a> 
				<a href="#">服务网点</a>  
				<a href="#">零售网点</a>  
				
			 </div>
			 <div class="span2">
				<h5>关注我们</h5>
				<a href="#">新浪微博</a> 
				<a href="#">小米部落</a>  
				<a href="#">官方微信</a>  
				
			 </div>

			<div id="socialMedia" class="span3 pull-right">
				<h5>关于小米</h5>
				<div>
				<a href="#"><img width="60" height="60" src="/qiantai/themes/images/3.jpg" title="facebook" alt="facebook"/></a>
				<a href="#"><img width="60" height="60" src="/qiantai/themes/images/2.jpg" title="twitter" alt="twitter"/></a>
				<a href="#"><img width="60" height="60" src="/qiantai/themes/images/1.jpg" title="youtube" alt="youtube"/></a>
			 </div> 
		 </div>

		<p class="pull-right">&copy;ＨＨＭ</p>
	</div><!-- Container End -->
	</div>
</body>
</html>